<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function ajax(url){
        fetch(url).then(data =>data.json()).then(data =>dataGen.next(data))
}

function *step(){
    console.log('fetching beers');
    const beers =yield ajax('http://api.react.beer/v2/search?q=hops&type=beer');
    console.log(beers);

    console.log('fetching wes');
    const wes = yield ajax('http://api.github.com/users/wesbos');
    console.log(wes);
    console.log('fetching fat joe');
    const fatJoe = yield ajax('http://api.discogs.com/artists/51980');
    console.log(fatJoe);
}
const dataGen = step();
dataGen.next();

    </script>
</body>
</html>